package com.sojson.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sojson.dao.SearchKeywordDao;
import com.sojson.entity.po.SearchKeyword;
import com.sojson.service.SearchKeywordService;

/**
 * 搜索关键词表Service实现类
 * 
 * @author liu
 * @date 2021-04-07
 */
@Service
public class SearchKeywordServiceImpl implements SearchKeywordService {

    @Resource
    private SearchKeywordDao searchKeywordDaoImpl;

    /**
     * 单条插入
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int insert(SearchKeyword searchKeyword) {
        int insert = searchKeywordDaoImpl.insert(searchKeyword);
        return insert;
    }

    /**
     * 批量插入
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int insertList(SearchKeyword searchKeyword) {
        int insertList = searchKeywordDaoImpl.insertList(searchKeyword.getSearchKeywords());
        return insertList;
    }

    /**
     * 通过对象批量删除(物理删除)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByDto(SearchKeyword searchKeyword) {
        int deleteByDto = searchKeywordDaoImpl.deleteByDto(searchKeyword);
        return deleteByDto;
    }

    /**
     * 统计全部数量
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public int countAll() {
        int countAll = searchKeywordDaoImpl.countAll();
        return countAll;
    }

    /**
     * 查询所有
     * 
     * @return
     * @throws SQLException
     */
    @Override
    public List<SearchKeyword> findAll() {
        List<SearchKeyword> findAll = searchKeywordDaoImpl.listAll();
        return findAll;
    }

    /**
     * 根据对象统计数量
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int countByDto(SearchKeyword searchKeyword) {
        int countByDto = searchKeywordDaoImpl.countByDto(searchKeyword);
        return countByDto;
    }

    /**
     * 根据对象查询
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public List<SearchKeyword> findByDto(SearchKeyword searchKeyword) {
        List<SearchKeyword> findByDto = searchKeywordDaoImpl.listByDto(searchKeyword);
        return findByDto;
    }

    /**
     * 通过id删除(物理删除)
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteById(Integer id) {
        int deleteById = searchKeywordDaoImpl.deleteById(id);
        return deleteById;
    }

    /**
     * 通过id列表删除(物理删除)
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public int deleteByIdList(ArrayList<Integer> ids) {
        int deleteByIdList = searchKeywordDaoImpl.deleteByIdList(ids);
        return deleteByIdList;
    }

    /**
     * 通过id更新(全部更新)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updateById(SearchKeyword searchKeyword) {
        int updateById = searchKeywordDaoImpl.updateById(searchKeyword);
        return updateById;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容相同)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticByIdList(SearchKeyword searchKeyword) {
        int updateStaticByIdList = searchKeywordDaoImpl.updateStaticByIdList(searchKeyword);
        return updateStaticByIdList;
    }

    /**
     * 通过id列表更新(全部更新)(更新内容不相同)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangeByIdList(SearchKeyword searchKeyword) {
        int updateChangeByIdList = searchKeywordDaoImpl.updateChangeByIdList(searchKeyword.getSearchKeywords());
        return updateChangeByIdList;
    }

    /**
     * 通过id更新(局部更新)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updatePartialById(SearchKeyword searchKeyword) {
        int updatePartialById = searchKeywordDaoImpl.updatePartialById(searchKeyword);
        return updatePartialById;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容相同)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updateStaticPartialByIdList(SearchKeyword searchKeyword) {
        int updateStaticPartialByIdList = searchKeywordDaoImpl.updateStaticPartialByIdList(searchKeyword);
        return updateStaticPartialByIdList;
    }

    /**
     * 通过id列表更新(局部更新)(更新内容不相同)
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public int updateChangePartialByIdList(SearchKeyword searchKeyword) {
        int updateChangePartialByIdList = searchKeywordDaoImpl.updateChangePartialByIdList(searchKeyword.getSearchKeywords());
        return updateChangePartialByIdList;
    }

    /**
     * 通过id查询
     * 
     * @param id
     * @return
     * @throws SQLException
     */
    @Override
    public SearchKeyword findById(Integer id) {
        SearchKeyword findById = searchKeywordDaoImpl.findById(id);
        return findById;
    }

    /**
     * 通过id列表查询
     * 
     * @param ids
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<SearchKeyword> findByIdList(ArrayList<Integer> ids) {
        ArrayList<SearchKeyword> findByIdList = searchKeywordDaoImpl.findByIdList(ids);
        return findByIdList;
    }

    /**
     * 通过对象查询id列表
     * 
     * @param searchKeyword
     * @return
     * @throws SQLException
     */
    @Override
    public ArrayList<Integer> findIdByDto(SearchKeyword searchKeyword) {
        ArrayList<Integer> findIdByDto = searchKeywordDaoImpl.findIdByDto(searchKeyword);
        return findIdByDto;
    }

    /**
     * 清空数据(物理清空)
     * 
     * @throws SQLException
     */
    @Override
    public void clear() {
        searchKeywordDaoImpl.clear();
    }

}